Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

101
Views
obtener datos JSON de esta estructura [JQuery]

Estoy tratando de obtener datos json de esta estructura:

 "items": { "adidas": [ { "name": "STAN SMITH PRIMEGREEN", "price": 84.9, "image": "https://m/dww/data/products/stan-smith-primegreen.png", "availability": [ { "size": 36, "quantity": 5 }, { "size": 37, "quantity": 7 }, { "size": 44, "quantity": 9 } ] }

Puedo obtener estos datos usando el siguiente código que funciona:

 const $showData = $("#show-data"); $.getJSON("data.json", (data) => { const markup = data.items.adidas.map((item) => ` <!--Product--> <img src="${item.image}" alt="shoes image" class="u-max-full-width"> <h3 class="bold title">${item.name}</h3> <h2 class="price">${item.price}</h2> <p class="subtitle">${item.brand}</p> <p class="desc">${item.description}</p> `) .join(""); const list = $("<p />").html(markup); $showData.html(list);

Pero cuando traté de obtener una matriz de disponibilidad (tamaño y cantidad).

data.items.adidas.availability.map y obtuve este error:

 Cannot read properties of undefined (reading 'map')
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!